package com.csii.mobilebanking.user;

import android.content.Context;
import android.view.Gravity;
import android.widget.Toast;

public class HpToast
{
	private static Context mContext = null;
	private static Toast mToast = null;
	
	public static void showMessageBottom(Context context,String aMsg)
	{
		showMessage(context, aMsg, 80, 0, 80);
	}
	
	public static void showMessageTop(Context context,String aMsg)
	{
		showMessage(context, aMsg, Gravity.TOP, 0, 0);
	}
	
	private static void showMessage(Context context,String aMsg, int gravity, int xOffset, int yOffset)
	{
//		if(mToast!=null)
		if(mContext == context)
		{
//			mToast.cancel();
			mToast.setText(aMsg);
		}
		else
		{
			mContext = context;
			mToast = Toast.makeText(mContext, null, 0);
			mToast.setGravity(gravity, xOffset, yOffset);
			mToast.setText(aMsg);
		}
		mToast.show();
	}
	
	public static void CancelMessage()
	{
		if(mContext != null)
		{
			mToast.cancel();
		}
	}
	
}
